import ajax from '../utils/ajax.js'
import store from 'store'
// 增加地址    
export const addBook = (data) => {
	// console.log(store.getters.getUserInfo.token);
	return ajax({
		url: `/base/user/book`,
		header: {
			authentication: store.getters.getUserInfo.token
		},
		method: 'POST',
		data
	})
}

// 查询本人地址簿列表
export const getBookl = (data) => {
	return ajax({
		url: `/base/user/book/list`,
		header: {
			authentication: store.getters.getUserInfo.token
		},
		data
	})
}

// 修改地址簿
export const updataBook = (data) => {
	return ajax({
		url: `/base/user/book`,
		header: {
			authentication: store.getters.getUserInfo.token
		},
		data,
		method: 'PUT'
	})
}

// 删除地址
export const delBook = (ids) => {
	return ajax({
		url: `/base/user/book/${ids}`,
		header: {
			authentication: store.getters.getUserInfo.token
		},
		method: 'DELETE'
	})
}

// 通过id获取地址簿详细信息
export const getBook = (id) => {
	return ajax({
		url: `/base/user/book/${id}`,
		header: {
			authentication: store.getters.getUserInfo.token
		}
	})
}